package org.restorator.dao.implement.engin;

import org.restorator.dao.jdbc.RowMapper;
import org.restorator.entity.Item;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author Snisar Bogdan.
 */
public class ItemRowMapper implements RowMapper<Item> {
    @Override
    public Item mapRow(ResultSet rs, int rowCount) {
    	Item item = new Item();
    	try {
	    	item.setCategoryName(rs.getString(5));
	    	item.setItemId(rs.getInt(1));
	    	item.setName(rs.getString(4));
	    	item.setPrice(rs.getInt(2));    	
			item.setDescription(rs.getString(3));
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        return item;  //To change body of implemented methods use File | Settings | File Templates.
    }
}
